import request from "@/utils/request"

export interface MessageItem {
  id: number
  title: string
  content: string
  sender: string
  receiver: string
  readCount: number
  receiverCount: number
  createTime: string
}

export interface MessageQuery {
  sender?: string
  pageIndex: number
  pageSize: number
}

export interface MessageListResult {
  list: MessageItem[]
  total: number
}

// 消息列表API
export async function fetchMessageList(query: MessageQuery): Promise<MessageListResult> {
  const res = await request.post<MessageListResult>("/api/admin/message/page", query)
  return res.data
}